package org.example.yuewen.solution17;

/**
 * @author: lynn
 * @Descript:  输出1的个数，利用 自身 按位与 自身-1 递归
 * @date: 2021/3/31 21:39
 * @version: 1.0
 */
public class Find1 {
    public static void main(String[] args) {
        int n=5;
        int count=0;
        while(n != 0){
            n = n & (n - 1);
            count++;
        }
        System.out.println(count);
    }
}
